﻿#define _CRT_SECURE_NO_WARNINGS 1

//编程初学者入门训练第105题
//BC107 矩阵转置
//https://www.nowcoder.com/practice/351b3d03e410496ab5a407b7ca3fd841?tpId=107&tqId=33388&rp=1&ru=/exam/oj/ta&qru=/exam/oj/ta&sourceUrl=%2Fexam%2Foj%2Fta%3Fpage%3D3%26tpId%3D107%26type%3D107&difficulty=undefined&judgeStatus=undefined&tags=&title=

#include <stdio.h>

int main() {
    int n = 0, m = 0;
    scanf("%d %d", &n, &m);
    int arr[10][10] = { 0 };

    //输入
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            scanf("%d", &arr[i][j]);
        }
    }

    //输出
    for (int i = 0; i < m; i++) {
        for (int j = 0; j < n; j++) {
            printf("%d ", arr[j][i]);
        }
        printf("\n");
    }

    return 0;
}